home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / store / IXStoreBlock.h < prev    next >
Text File  |  1993-02-18  |  3KB  |  98 lines

  1. /*
  2. IXStoreBlock.h
  3. Copyright 1991, NeXT Computer, Inc.
  4. */
  5.  
  6. #import    "protocols.h"
  7. #import    "IXStore.h"
  8.  
  9. #import    <remote/transport.h>
  10. #import <machkit/reference.h>
  11. #import    <objc/Object.h>
  12.  
  13. extern unsigned 
  14. IXWriteRootObjectToStore(IXStore *aStore, unsigned aHandle, id anObject);
  15.  
  16. extern id 
  17. IXReadObjectFromStore(IXStore *aStore, unsigned aHandle, NXZone *aZone);
  18.  
  19. // This is a convenience class, most often used to associate a named store 
  20. // directory entry with an archived object.  It distributes by copy, using the 
  21. // exportBlock:atOffset:forLength: and importBlock:atOffset:forLength: methods 
  22. // of IXStore to provide remote access the contents of the block.
  23.  
  24. @interface IXStoreBlock: Object <NXReference,NXTransport,IXBlockAndStoreAccess>
  25. {
  26.     unsigned        _references;
  27. @public
  28.     IXStore        *store;
  29.     unsigned        handle;
  30.     unsigned        blockSize;
  31. @protected
  32.     id            blockData;
  33.     unsigned        readOffset;
  34.     unsigned        readLength;
  35. }
  36.  
  37. // Returns the receiver's store, primarily as a convenience for transaction 
  38. // management - e.g., [[client store] startTransaction].
  39.  
  40. - (IXStore *)store;
  41.  
  42. // Closes the block if there is only one outstanding reference.  This makes the 
  43. // block available to other contexts, unless the block has been modified.
  44.  
  45. - close;
  46.  
  47. // Opens the block for reading, returning a pointer to a copy of the block's 
  48. // contents. Each invocation invalidates the pointer returned by the previous 
  49. // invocation, unless the supplied offset and length are the same as for the 
  50. // previous invocation.  The block's contents will not be modified, regardless 
  51. // of what the sender does to the copy, until writeAtOffset:forLength: is sent.  
  52.  
  53. - (unsigned char *)readAtOffset:(unsigned)offset forLength:(unsigned)length;
  54.  
  55. // These two methods return the offset and length supplied to the most recent 
  56. // invocation of readAtOffset:forLength:.
  57.  
  58. - (unsigned)readOffset;
  59. - (unsigned)readLength;
  60.  
  61. // Writes the copy of the block's contents, as modified by the sender, to the 
  62. // store, opening the block for modification in the process.  The supplied 
  63. // offset and length must define a complete subset of the range opened by the 
  64. // previous invocation of readAtOffset:forLength:.
  65.  
  66. - writeAtOffset:(unsigned)offset forLength:(unsigned)length;
  67.  
  68. // Copies the block, returning the handle of the result of the copy.
  69. - (unsigned)copyAtOffset:(unsigned)offset forLength:(unsigned)length;
  70.  
  71. - (unsigned)size; // Locks and determines the size of the block.
  72.  
  73. // Resizes the block.  This invalidates the pointer to the block's contents 
  74. // returned by readAtOffset:forLength:.  A new pointer to the block's contents 
  75. // must be accquired if further access to the contents is necessary.
  76.  
  77. - resizeTo:(unsigned)size;
  78.  
  79. // Opens typed stream on the block's contents, and calls NXReadObject() to 
  80. // unarchive the contents of the typed stream.
  81.  
  82. - readObject;
  83.  
  84. // Calls NXWriteRootObject() on the supplied object, resizes the block to fit 
  85. // the resulting buffer, and copies the contents of the buffer to the block 
  86. // with writeAtOffset:forLength:.
  87.  
  88. - writeObject:anObject;
  89.  
  90. // This method does not distribute, since it returns a pointer to the actual 
  91. // block contents obtained from openBlock:atOffset:forLength:.  It is provided 
  92. // for compatibility and for efficiency with a local store.
  93.  
  94. - (unsigned char *)openAtOffset:(unsigned)offset forLength:(unsigned)length;
  95.  
  96. @end
  97.  
  98.